package hu.mapro.gwtui.server.data;

import javax.annotation.Resource;

import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import com.google.web.bindery.requestfactory.shared.ServiceLocator;

@Component
public class GwtServiceLocator implements ServiceLocator {

	@Resource
	ApplicationContext context;
	
//	HttpServletRequest request = RequestFactoryServlet.getThreadLocalRequest();
//	ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());

	@Override
	public Object getInstance(Class<?> clazz) {
		return context.getBean(clazz);
	}
}
